﻿Public Class Toolbox

 
    Private Sub Toolbox_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.TopMost = True
    End Sub




    Private Sub lblWebsite_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblWebsite.DragEnter
        ' See if the data includes a Label.

        ' There is Label data. Allow copy.
        e.Effect = DragDropEffects.Copy

        ' Highlight the control.
        lblWebsite.BorderStyle = BorderStyle.FixedSingle
        
    End Sub

    Private Sub lblWebsite_DragLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblWebsite.DragLeave
        ' There is no Label. Prohibit drop.
        lblWebsite.BorderStyle = BorderStyle.None
    End Sub

    Private Sub lblWebsite_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblWebsite.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            'begin drag
            Dim ifneeded As String = "http://"

            lblWebsite.DoDragDrop(ifneeded & lblWebsite.Text, DragDropEffects.All)
        Else

        End If
    End Sub

    Private Sub lblPassword_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblPassword.DragEnter
        ' See if the data includes a Label.

        ' There is Label data. Allow copy.
        e.Effect = DragDropEffects.Copy

        ' Highlight the control.
        lblPassword.BorderStyle = BorderStyle.FixedSingle

    End Sub

    Private Sub lblPassword_DragLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPassword.DragLeave
        lblPassword.BorderStyle = BorderStyle.None
    End Sub

  

    Private Sub lblPassword_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblPassword.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            lblPassword.DoDragDrop(lblPassword2.Text, DragDropEffects.All)
        End If
    End Sub

    Private Sub lblPassword2_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblPassword2.DragEnter

        ' There is Label data. Allow copy.
        e.Effect = DragDropEffects.Copy

        ' Highlight the control.
        lblPassword2.BorderStyle = BorderStyle.FixedSingle
    End Sub

    Private Sub lblPassword2_DragLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPassword2.DragLeave
        lblPassword2.BorderStyle = BorderStyle.None
    End Sub


    Private Sub lblPassword2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblPassword2.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            lblPassword.DoDragDrop(lblPassword2.Text, DragDropEffects.All)
        End If
    End Sub

    Private Sub lblUsername_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblUsername.DragEnter
        ' See if the data includes a Label.

        ' There is Label data. Allow copy.
        e.Effect = DragDropEffects.Copy

        ' Highlight the control.
        lblUsername.BorderStyle = BorderStyle.FixedSingle

    End Sub

    Private Sub lblUsername_DragLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblUsername.DragLeave
        lblUsername.BorderStyle = BorderStyle.None
    End Sub

    Private Sub lblUsername_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblUsername.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            lblUsername.DoDragDrop(lblUsername.Text, DragDropEffects.All)
        End If
    End Sub

    
    Private Sub cmdLockPasswords_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLockPasswords.Click

        lblStatus.Visible = False
        PictureBoxStatus.Visible = False

        If lblPassword.Visible = True Then
            lblPassword.Visible = False
            lblPassword2.Visible = True
        Else
            lblPassword.Visible = True
            lblPassword2.Visible = False
        End If
    End Sub

    Private Sub cmdCopyUserid_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCopyUserid.Click
        Call Common.CopyUseridToClipBoard(Me.lblPasswordID.Text)
    End Sub

    Private Sub cmdCopyPassword_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCopyPassword.Click
        Call Common.CopyPasswordtoClipboard(lblPasswordID.Text)
    End Sub

    Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click
        Call Common.DeletePassword(Common.CurrentlySelectedPasswordID)
        lblStatus.Visible = False
        PictureBoxStatus.Visible = False

    End Sub

    Private Sub cmdLaunchWeblink_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLaunchWeblink.Click
        Call Common.LaunchInBrowser(Me.lblPasswordID.Text)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Passwords.WindowState = FormWindowState.Normal
        Passwords.BringToFront()

        If Passwords.GroupBoxLogin.Visible = False Then
            Passwords.Visible = True
            Passwords.BringToFront()
            Common.PasswordSelected(Me.lblPasswordID.Text)
        Else
            Passwords.txtSearch.Text = "ID:" & lblPasswordID.Text
        End If

        Me.Visible = False
    End Sub

    Private Sub cmdStatusOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStatusOk.Click
        Passwords.NextMessage()
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub
End Class